package com.yhb.dao;

import com.yhb.model.MonthlySumUp;
import com.yhb.model.SplittingFlow;
import com.yhb.model.UserApproximatelyIncome;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

public interface FlowSumUpMapper {
    /** 日交易量相关 */
    int storeUserAmount(@Param("splittingType") String splittingType,
                        @Param("monthString")String monthString,
                        @Param("userId") String userId,
                        @Param("date")String date,
                        @Param("amount")BigDecimal amount,
                        @Param("selfAmount")BigDecimal selfAmount,
                        @Param("ordinaryAmount")BigDecimal ordinaryAmount);

    MonthlySumUp sumUpUserId(@Param("splittingType") String splittingType,
                             @Param("userId")String userId,
                             @Param("monthString")String monthString);

    int removeDateFlows(@Param("splittingType")String splittingType,
                        @Param("monthString") String monthString,
                        @Param("date") String dateString);

    /** 月交易量相关 */
    int clearMonthlySumUp(@Param("splittingType") String splittingType,
                          @Param("monthString")String monthString);

    int insertMonthlySumUp(@Param("splittingType") String splittingType,
                           @Param("sum")MonthlySumUp sumUp,
                           @Param("monthString")String monthString);

    MonthlySumUp getSumUpByUserId(@Param("splittingType") String splittingType,
                                  @Param("monthString")String monthString,
                                  @Param("userId")String userId);

    int modifySumUp(@Param("splittingType") String splittingType,
                    @Param("monthString")String monthString,
                    @Param("sum")MonthlySumUp sumUp);

    /** 分润计算相关 */
    int insertSplittingFlow(@Param("splittingType") String splittingType,
                            @Param("monthString") String monthString,
                            @Param("flow") SplittingFlow flow);

    SplittingFlow sumUpSplitting(@Param("splittingType") String splittingType,
                                 @Param("monthString")String monthString,
                                 @Param("userId")String userId,
                                 @Param("type")SplittingFlow.Type type);

    SplittingFlow sumUpSplittingFromTimeScale(@Param("splittingType") String splittingType,
                                 @Param("monthString")String monthString,
                                 @Param("userId")String userId,
                                 @Param("startTime") Date startTime,
                                 @Param("endTime") Date endTime);

    int clearSplitting(@Param("splittingType") String splittingType,
                       @Param("monthString")String monthString);


    int insertUserApproximatelyIncome(@Param("income") UserApproximatelyIncome income);
    UserApproximatelyIncome userApproximatelyIncome(@Param("userId") String userId);

}
